Skip to main content
Version: 5.3.2

sha3

sha3

Helper function that will sha3 any value using keccak256.

Usage

TronWeb.sha3(value);

Parameters

ParameterDescriptionData Type
stringThe string that needs to be hashed using Keccak-256 SHA3 algorithm.String
prefixthe result includes 0x prefix if set as trueBoolean

Returns

String - The result hashed using the Keccak-256 SHA3 algorithm.

Example


> var hash = TronWeb.sha3("some string to be hashed");
console.log(hash)
> '0xc4b9bbe7eb8797cf2818085dbcd6ea6662b3261c28810c318e079c8d0c691da6'
> var hashOfHash = TronWeb.sha3(hash, false)
> '0xc4b9bbe7eb8797cf2818085dbcd6ea6662b3261c28810c318e079c8d0c691da6'